package b2.widget.guide
{
	import b2.config.*;
	import b2.net.*;
	
	import flash.display.Sprite;
	import flash.filters.*;
	import flash.text.*;

	public class TankSelectItem extends Sprite
	{
		public function TankSelectItem(tankIndex:int)
		{
			super();
			var tankConfig:TankConfig = Config.objectConfigs[tankIndex];
			//图标
			var TankIcon:Class = ResourceHelper.getInstance().getClassByName(tankConfig.iconImage);
			var tankIcon:Sprite = new TankIcon();
			tankIcon.width = 140;
			tankIcon.height = 140;
			addChild(tankIcon);
			//坦克名字
			var tankTitle:TextField = new TextField();
			tankTitle.selectable = false;
			tankTitle.defaultTextFormat = new TextFormat("微软雅黑", 18, 0x000000);
			tankTitle.filters = [new GlowFilter(0xFFFFFF, 1, 1.3, 1.3, 100, BitmapFilterQuality.HIGH)];
			tankTitle.text = tankConfig.name;
			tankTitle.x = 10;
			tankTitle.y = 156;
        	tankTitle.autoSize = TextFieldAutoSize.CENTER;
			addChild(tankTitle);
			//坦克属性
			//攻击
			var attackPoint:TextField = new TextField();
			attackPoint.selectable = false;
        	attackPoint.autoSize = TextFieldAutoSize.CENTER;
			attackPoint.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			attackPoint.text = "攻击：" + parseInt(tankConfig.attackPoint[0]);
			attackPoint.x = -168;
			attackPoint.y = -26;
			addChild(attackPoint);
			//防御
			var armPoint:TextField = new TextField();
			armPoint.selectable = false;
        	armPoint.autoSize = TextFieldAutoSize.CENTER;
			armPoint.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			armPoint.text = "防御：" + parseInt(tankConfig.armPoint[0]);
			armPoint.x = -166;
			armPoint.y = 53;
			addChild(armPoint);
			//生命
			var healthPoint:TextField = new TextField();
			healthPoint.selectable = false;
        	healthPoint.autoSize = TextFieldAutoSize.CENTER;
			healthPoint.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			healthPoint.text = "生命：" + parseInt(tankConfig.healthPoint[0]);
			healthPoint.x = -166;
			healthPoint.y = 147;
			addChild(healthPoint);
			//暴击率
			var caRatio:TextField = new TextField();
			caRatio.selectable = false;
        	caRatio.autoSize = TextFieldAutoSize.CENTER;
			caRatio.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			caRatio.text = "暴击：" + parseInt(tankConfig.criticalAttackRatio[0]);
			caRatio.x = 238;
			caRatio.y = -15;
			addChild(caRatio);
			//能量
			var energyPoint:TextField = new TextField();
			energyPoint.selectable = false;
        	energyPoint.autoSize = TextFieldAutoSize.CENTER;
			energyPoint.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			energyPoint.text = "能量：" + parseInt(tankConfig.energyPoint[0]);
			energyPoint.x = 238;
			energyPoint.y = 53;
			addChild(energyPoint);
			//速度
			var speed:TextField = new TextField();
			speed.selectable = false;
        	speed.autoSize = TextFieldAutoSize.CENTER;
			speed.defaultTextFormat = new TextFormat("微软雅黑", 16, 0x000000);
			speed.text = "速度：" + tankConfig.moveVelocity;
			speed.x = 238;
			speed.y = 139;
			addChild(speed);
		}
		
	}
}